#include "juliaScene.h"

JuliaScene::JuliaScene()
{
	m_qRot = quat(1.f, 0.f, 0.f, 0.f);
	m_position = vec3(0);

	if (nullptr == m_Camera)
	{
		m_Camera = new Camera3D();
	}

	if (nullptr == m_RootObj)
	{
		m_RootObj = new SceneObj(nullptr, nullptr, "Root Obj");
		if (nullptr == m_SelectedObj)
		{
			m_SelectedObj = new SceneObj(nullptr, new SW::JuliaSprite(), "qJulia");
		}
		m_RootObj->PushChild(m_SelectedObj);
	}
}

JuliaScene::~JuliaScene()
{
	if (m_Camera)
	{
		delete m_Camera;
		m_Camera = nullptr;
	}

	/*if (m_SelectedObj)
	{
		delete m_SelectedObj;
		m_SelectedObj = nullptr;
	}*/

	if (m_RootObj)
	{
		delete m_RootObj;
		m_RootObj = nullptr;
	}
}

void JuliaScene::Update(float deltaTime)
{
	if (m_Camera)
	{
		m_Camera->Update(deltaTime);
	}	
}

void JuliaScene::Render()
{
	SW::Renderer::SetCurrentCamera(m_Camera);

	if (m_RootObj)
	{
		m_RootObj->Render();
	}
}

void JuliaScene::RenderSwGui()
{
	SW::Begin("Menu");
	SW::End();
}